<template>
	<view>
		<image src="../../../static/me/bg1.jpg" mode="" style="position: fixed;top: 0; left: 0;width: 100vw; height: 100vh;"></image>
		<view style="z-index: 100;position: absolute;width: 100vw;padding: 10px;">
			<view >
				<textarea v-model="content" placeholder="输入你的建议或发现的问题(最多100字)..." maxlength="300" style="border: 1px solid #7d7d7d;margin: 0 auto;" />
			</view>
			
			<view style="text-align: center; margin: 30rpx;">
				<button size="mini" type="primary" @click="confirm()" >反馈</button>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: '',
				limit: 0
			}
		},
		methods: {
			confirm(){
				if( this.content.length <= 0){
					this.$msg("内容不能为空")
					return;
				}
				if(this.content.length > 100){
					this.$msg("字数超过限制")
					return;
				}
				if(this.limit >= 3){
					this.$msg("访问频繁，请稍后重试")
					return;
				}
				let that = this;
				that.$request("/advice?advice=" + that.content, "POST").then(result => {
					that.limit++;
					that.content = '';
					that.$msg("已收到，感谢您的反馈")
				})
			}
		}
	}
</script>

<style>

</style>
